package com.telsoft.hms.data;

import com.telsoft.hms.entity.ETT_OrderServiceDTL;
import com.telsoft.hms.lib.admin.client.data.ClientDataPreprocessor;

public class HMS_OrderServiceDTL_DATA extends ClientDataPreprocessor {
	/**
	 * Hủy yêu cầu dịch vụ
	 * 
	 * @author MinhTQ
	 * @param strSecurityKey
	 *            Mã bảo mật
	 * @param objOSDTL
	 *            đối tượng order service detail
	 * @throws Exception
	 *             Ngày tạo: 09/10/2014
	 */
	@SuppressWarnings("finally")
	public boolean deleteOrderServiceDTL(String strHospitalKey,
			ETT_OrderServiceDTL objOSDTL) throws Exception {
		boolean flag = true;		
		try {
			open(strHospitalKey);
			mConnection.setAutoCommit(false);
			String strSql = "UPDATE ORDER_SERVICE_DTL SET STATUS = 0 WHERE ORDER_SERVICE_DTL_ID=?";
			
			// Hủy yêu cầu dịch vụ theo id yêu cầu dịch vụ
			mStmt = mConnection.prepareStatement(strSql);
			mStmt.setLong(1, objOSDTL.getOrderServiceDTLId());
			mStmt.executeUpdate();						
			mConnection.commit();
		} catch (Exception ex) {
			mConnection.rollback();
			flag = false;
			throw ex;
		} finally {
			close(mStmt);
			close(mConnection);
			return flag;
		}
	}
		
}
